"""
author: Jackson Black
time: 2023-08-20 11-11-50 
数据结构：list,set,dict,tuple
"""


# 元素可重复
def list_():
    # 生成式
    lis = [i for i in range(1, 10)]
    for i in lis:
        print(i, end=",")
    # 常见 api: index,append,sort,pop,remove....
    print("6的个数为:", lis.count(6))


# 元素唯一
def set_():
    se = {i for i in range(1, 10)}
    for i in se:
        print(i, end=",")
    # 常见api：add,pop,copy,update,remove


# 元组的元素不能修改
def tuple_():
    tup = (i for i in range(1, 10))
    for i in tup:
        print(i, end=",")


# 数据以键值对形式展示
def dict_():
    dic = {"name": "Jackson", "age": 21, "gender": "male"}
    # 同上  dic = dict(name=Jackson,age=21,gender=male)
    print(f'name={dic["name"]}\tage={dic["age"]}\tgender={dic["gender"]}')
    print(dic.items())
    print(dic.values())
    print(dic.keys())
    print(dic.get("gender"))
    # 常用api get,items,keys,values,popitem


if __name__ == "__main__":
    # list_()
    # set_()
    # tuple_()
    dict_()
